package ink.onei.shopping.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ink.onei.shopping.mapper.DetailMapper;
import ink.onei.shopping.domain.Detail;
import ink.onei.shopping.service.IDetailService;

/**
 * 商品规格Service业务层处理
 * 
 * @author nekotako
 * @date 2024-02-07
 */
@Service
public class DetailServiceImpl implements IDetailService  {
    @Autowired
    private DetailMapper detailMapper;

    /**
     * 查询商品规格
     * 
     * @param detailId 商品规格主键
     * @return 商品规格
     */
    @Override
    public Detail selectDetailByDetailId(Long detailId) {
        return detailMapper.selectDetailById(detailId);
    }

    /**
     * 查询商品规格列表
     * 
     * @param detail 商品规格
     * @return 商品规格
     */
    @Override
    public List<Detail> selectDetailList(Detail detail) {
        return detailMapper.selectDetailList(detail);
    }

    /**
     * 新增商品规格
     * 
     * @param detail 商品规格
     * @return 结果
     */
    @Transactional
    @Override
    public int insertDetail(Detail detail) {
        return detailMapper.insertDetail(detail);
    }

    /**
     * 修改商品规格
     * 
     * @param detail 商品规格
     * @return 结果
     */
    @Transactional
    @Override
    public int updateDetail(Detail detail) {
        return detailMapper.updateDetail(detail);
    }

    /**
     * 批量删除商品规格
     * 
     * @param detailIds 需要删除的商品规格主键
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteDetailByIds(Long[] detailIds) {
        return detailMapper.deleteDetailByIds(detailIds);
    }

    /**
     * 删除商品规格信息
     * 
     * @param detailId 商品规格主键
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteDetailById(Long detailId) {
        return detailMapper.deleteDetailById(detailId);
    }
}
